(0) Obligation:

Runtime Complexity TRS:
The TRS R consists of the following rules:

p(0) → 0
p(s(X)) → X
leq(0, Y) → true
leq(s(X), 0) → false
leq(s(X), s(Y)) → leq(X, Y)
if(true, X, Y) → activate(X)
if(false, X, Y) → activate(Y)
diff(X, Y) → if(leq(X, Y), n__0, n__s(n__diff(n__p(X), Y)))
0n__0
s(X) → n__s(X)
diff(X1, X2) → n__diff(X1, X2)
p(X) → n__p(X)
activate(n__0) → 0
activate(n__s(X)) → s(activate(X))
activate(n__diff(X1, X2)) → diff(activate(X1), activate(X2))
activate(n__p(X)) → p(activate(X))
activate(X) → X

Rewrite Strategy: INNERMOST

(1) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)

Converted CpxTRS to CDT

(2) Obligation:

Complexity Dependency Tuples Problem
Rules:

p(0) → 0
p(s(z0)) → z0
p(z0) → n__p(z0)
leq(0, z0) → true
leq(s(z0), 0) → false
leq(s(z0), s(z1)) → leq(z0, z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
diff(z0, z1) → if(leq(z0, z1), n__0, n__s(n__diff(n__p(z0), z1)))
diff(z0, z1) → n__diff(z0, z1)
0n__0
s(z0) → n__s(z0)
activate(n__0) → 0
activate(n__s(z0)) → s(activate(z0))
activate(n__diff(z0, z1)) → diff(activate(z0), activate(z1))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
Tuples:

P(0) → c(0')
LEQ(s(z0), s(z1)) → c5(LEQ(z0, z1))
IF(true, z0, z1) → c6(ACTIVATE(z0))
IF(false, z0, z1) → c7(ACTIVATE(z1))
DIFF(z0, z1) → c8(IF(leq(z0, z1), n__0, n__s(n__diff(n__p(z0), z1))), LEQ(z0, z1))
ACTIVATE(n__0) → c12(0')
ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
S tuples:

P(0) → c(0')
LEQ(s(z0), s(z1)) → c5(LEQ(z0, z1))
IF(true, z0, z1) → c6(ACTIVATE(z0))
IF(false, z0, z1) → c7(ACTIVATE(z1))
DIFF(z0, z1) → c8(IF(leq(z0, z1), n__0, n__s(n__diff(n__p(z0), z1))), LEQ(z0, z1))
ACTIVATE(n__0) → c12(0')
ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:

p, leq, if, diff, 0, s, activate

Defined Pair Symbols:

P, LEQ, IF, DIFF, ACTIVATE

Compound Symbols:

c, c5, c6, c7, c8, c12, c13, c14, c15

(3) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)

Removed 2 leading nodes:

IF(true, z0, z1) → c6(ACTIVATE(z0))
IF(false, z0, z1) → c7(ACTIVATE(z1))
Removed 4 trailing nodes:

P(0) → c(0')
ACTIVATE(n__0) → c12(0')
LEQ(s(z0), s(z1)) → c5(LEQ(z0, z1))
DIFF(z0, z1) → c8(IF(leq(z0, z1), n__0, n__s(n__diff(n__p(z0), z1))), LEQ(z0, z1))

(4) Obligation:

Complexity Dependency Tuples Problem
Rules:

p(0) → 0
p(s(z0)) → z0
p(z0) → n__p(z0)
leq(0, z0) → true
leq(s(z0), 0) → false
leq(s(z0), s(z1)) → leq(z0, z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
diff(z0, z1) → if(leq(z0, z1), n__0, n__s(n__diff(n__p(z0), z1)))
diff(z0, z1) → n__diff(z0, z1)
0n__0
s(z0) → n__s(z0)
activate(n__0) → 0
activate(n__s(z0)) → s(activate(z0))
activate(n__diff(z0, z1)) → diff(activate(z0), activate(z1))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
Tuples:

ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
S tuples:

ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
K tuples:none
Defined Rule Symbols:

p, leq, if, diff, 0, s, activate

Defined Pair Symbols:

ACTIVATE

Compound Symbols:

c13, c14, c15

(5) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^1))) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
We considered the (Usable) Rules:

activate(n__0) → 0
activate(n__s(z0)) → s(activate(z0))
activate(n__diff(z0, z1)) → diff(activate(z0), activate(z1))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
p(z0) → n__p(z0)
diff(z0, z1) → if(leq(z0, z1), n__0, n__s(n__diff(n__p(z0), z1)))
diff(z0, z1) → n__diff(z0, z1)
s(z0) → n__s(z0)
0n__0
And the Tuples:

ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = [1]   
POL(ACTIVATE(x1)) = x1   
POL(DIFF(x1, x2)) = 0   
POL(P(x1)) = 0   
POL(S(x1)) = 0   
POL(activate(x1)) = [5]   
POL(c13(x1, x2)) = x1 + x2   
POL(c14(x1, x2, x3)) = x1 + x2 + x3   
POL(c15(x1, x2)) = x1 + x2   
POL(diff(x1, x2)) = [3] + [3]x1 + [2]x2   
POL(if(x1, x2, x3)) = [3] + [3]x1 + [3]x3   
POL(leq(x1, x2)) = [3] + [3]x1 + [2]x2   
POL(n__0) = [3]   
POL(n__diff(x1, x2)) = x1 + x2   
POL(n__p(x1)) = [2] + x1   
POL(n__s(x1)) = x1   
POL(p(x1)) = [3] + [3]x1   
POL(s(x1)) = [2] + [3]x1   

(6) Obligation:

Complexity Dependency Tuples Problem
Rules:

p(0) → 0
p(s(z0)) → z0
p(z0) → n__p(z0)
leq(0, z0) → true
leq(s(z0), 0) → false
leq(s(z0), s(z1)) → leq(z0, z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
diff(z0, z1) → if(leq(z0, z1), n__0, n__s(n__diff(n__p(z0), z1)))
diff(z0, z1) → n__diff(z0, z1)
0n__0
s(z0) → n__s(z0)
activate(n__0) → 0
activate(n__s(z0)) → s(activate(z0))
activate(n__diff(z0, z1)) → diff(activate(z0), activate(z1))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
Tuples:

ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
S tuples:

ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
K tuples:

ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
Defined Rule Symbols:

p, leq, if, diff, 0, s, activate

Defined Pair Symbols:

ACTIVATE

Compound Symbols:

c13, c14, c15

(7) CdtPolyRedPairProof (UPPER BOUND (ADD(O(n^1))) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
We considered the (Usable) Rules:

activate(n__0) → 0
activate(n__s(z0)) → s(activate(z0))
activate(n__diff(z0, z1)) → diff(activate(z0), activate(z1))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
p(z0) → n__p(z0)
diff(z0, z1) → if(leq(z0, z1), n__0, n__s(n__diff(n__p(z0), z1)))
diff(z0, z1) → n__diff(z0, z1)
s(z0) → n__s(z0)
0n__0
And the Tuples:

ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = [3]   
POL(ACTIVATE(x1)) = x1   
POL(DIFF(x1, x2)) = 0   
POL(P(x1)) = [1]   
POL(S(x1)) = 0   
POL(activate(x1)) = [3]   
POL(c13(x1, x2)) = x1 + x2   
POL(c14(x1, x2, x3)) = x1 + x2 + x3   
POL(c15(x1, x2)) = x1 + x2   
POL(diff(x1, x2)) = [5] + [3]x1 + [2]x2   
POL(if(x1, x2, x3)) = [3] + [2]x1 + [3]x2 + [3]x3   
POL(leq(x1, x2)) = [2] + [3]x1 + [4]x2   
POL(n__0) = [2]   
POL(n__diff(x1, x2)) = [3] + x1 + x2   
POL(n__p(x1)) = [4] + x1   
POL(n__s(x1)) = [2] + x1   
POL(p(x1)) = [3] + [4]x1   
POL(s(x1)) = [2] + [3]x1   

(8) Obligation:

Complexity Dependency Tuples Problem
Rules:

p(0) → 0
p(s(z0)) → z0
p(z0) → n__p(z0)
leq(0, z0) → true
leq(s(z0), 0) → false
leq(s(z0), s(z1)) → leq(z0, z1)
if(true, z0, z1) → activate(z0)
if(false, z0, z1) → activate(z1)
diff(z0, z1) → if(leq(z0, z1), n__0, n__s(n__diff(n__p(z0), z1)))
diff(z0, z1) → n__diff(z0, z1)
0n__0
s(z0) → n__s(z0)
activate(n__0) → 0
activate(n__s(z0)) → s(activate(z0))
activate(n__diff(z0, z1)) → diff(activate(z0), activate(z1))
activate(n__p(z0)) → p(activate(z0))
activate(z0) → z0
Tuples:

ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
S tuples:none
K tuples:

ACTIVATE(n__p(z0)) → c15(P(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__s(z0)) → c13(S(activate(z0)), ACTIVATE(z0))
ACTIVATE(n__diff(z0, z1)) → c14(DIFF(activate(z0), activate(z1)), ACTIVATE(z0), ACTIVATE(z1))
Defined Rule Symbols:

p, leq, if, diff, 0, s, activate

Defined Pair Symbols:

ACTIVATE

Compound Symbols:

c13, c14, c15

(9) SIsEmptyProof (EQUIVALENT transformation)

The set S is empty

(10) BOUNDS(O(1), O(1))